/**
 * User: zsquirrel
 * Date: 2020/4/28
 * Time: 4:45 下午
 */
package com.cskaoyan.mall.service;

import com.cskaoyan.mall.dao.AdminDao;
import com.cskaoyan.mall.dao.AdminDaoImpl;
import com.cskaoyan.mall.model.Admin;

import java.util.List;

public class AdminServiceImpl implements AdminService {

    private AdminDao adminDao = new AdminDaoImpl();

    @Override
    public int login(Admin admin) {

        return adminDao.login(admin);
    }

    @Override
    public List<Admin> allAdmins() {

        return adminDao.allAdmins();
    }

    /**
     * 需不需要做什么逻辑
     * 动态sql语句
     * 什么参数都没有
     * select * from admin;
     * 如果仅有一个账户或者昵称
     * select * from admin where email like/ nickname like
     * 如果两个参数都有
     * select * from admin where email like and nickname like
     * @param params
     * @return
     */
    @Override
    public List<Admin> getSearchAdmins(Admin params) {

        return adminDao.getSearchAdmins(params);
    }

    @Override
    public void addAdmin(Admin admin) {
        adminDao.addAdmin(admin);
    }

    @Override
    public Admin getAdminInfo(String id) {
        return adminDao.getAdminInfo(id);
    }

    @Override
    public void updateAdmin(Admin admin) {
        adminDao.updateAdmin(admin);
    }
}
